package com.example.forum.services.impl;

import com.example.forum.entity.Board;
import com.example.forum.mapper.BoardMapper;
import com.example.forum.services.IBoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BoardServiceImpl implements IBoardService {

    @Autowired
    private BoardMapper boardMapper;

    /**
     * 获取板块列表
     *
     * @param boardSize
     * @return
     */
    public List<Board> getList(Integer boardSize) {
        return boardMapper.getList(boardSize);
    }

    /**
     * 根据id获取板块
     *
     * @param boardId
     * @return
     */
    public Board getById(Long boardId) {
        return boardMapper.getById(boardId);
    }

    /**
     * 更新板块文章数量
     *
     * @param boardId
     */
    public Integer updateArticleCount(Long boardId) {
        return boardMapper.updateArticleCount(boardId);
    }

}
